//
//  SimpleNewsCell.m
//  USB_Reader
//
//  Created by why on 15-3-23.
//  Copyright (c) 2015年 Tony_Wang. All rights reserved.
//

#import "SimpleNewsCell.h"

@interface SimpleNewsCell ()

@property (nonatomic, retain) UILabel *labelTitle;
@property (nonatomic, retain) UILabel *lableTime;
@property (nonatomic, retain) UIImageView *myImage;

@end


@implementation SimpleNewsCell

- (void)dealloc
{
    [_newmodel release];
    [_labelTitle release];
    [_lableTime release];
    [_myImage release];
    [super dealloc];
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        self.myImage = [[UIImageView alloc] init];
        [self.contentView addSubview:self.myImage];
        
        self.labelTitle = [[UILabel alloc] init];
        [self.myImage addSubview:self.labelTitle];
      
    
        self.lableTime = [[UILabel alloc] init];
        [self.myImage addSubview:self.lableTime];
        
        
        [_labelTitle release];
        [_lableTime release];
        [_myImage release];
    }
    return self;
}


-(void)layoutSubviews
{
    [super layoutSubviews];
    
    CGFloat width = self.contentView.frame.size.width;
    
    CGFloat height = self.contentView.frame.size.height;
   
    
    
    self.labelTitle.frame = CGRectMake(10, 0, width/2, height);
    self.lableTime.frame = CGRectMake(40+width/2, 0, width/2, height);
    
//    self.myImage.layer.shadowColor = [UIColor blackColor].CGColor;
//    self.myImage.layer.shadowOffset = CGSizeMake(0, 5);
//    self.myImage.layer.shadowOpacity = 0.9;
    self.myImage.image = [UIImage imageNamed:@"shawanyi.jpg"];
    self.myImage.frame = CGRectMake(5, 0, width - 5, height - 3);
    self.myImage.userInteractionEnabled = YES;
    
}




- (void)setNewmodel:(NewModel *)newmodel
{
    if (_newmodel != newmodel) {
        [_newmodel release];
         _newmodel = [newmodel retain];
    }
    
    
  
    _lableTime.text = self.newmodel.time;
    _labelTitle.text = self.newmodel.title;
    _labelTitle.numberOfLines = 0;
    
    
    _lableTime.font = [UIFont boldSystemFontOfSize:9];
    
    
}




- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
